import request from '../utils/request';
/**
 * 获取文章列表
 */
export const getArticleList = (params) => {
  return request({
    url: '/v1_0/mp/articles',
    params,
  });
};
/**
 * 删除文章
 */
export const delArticle = (target) => {
  return request({
    url: '/v1_0/mp/articles/' + target,
    method: 'delete',
  });
};
/**
 * 发表文章
 */
export const publicArticle = (data, draft = false) => {
  return request({
    url: `/v1_0/mp/articles?draft=${draft}`,
    method: 'post',
    data,
  });
};

/**
 * 编辑文章
 */
export const editArticle = (data, id, draft = false) => {
  return request({
    url: `/v1_0/mp/articles/${id}?draft=${draft}`,
    method: 'put',
    data,
  });
};
/**
 * 获取文章详情
 */
export const getArticleDetail = (id) => {
  return request({
    url: '/v1_0/mp/articles/' + id,
    method: 'get',
  });
};
